package com.jcl.recruit.searchresume.logic;

import com.jcl.core.constants.Constant;
import com.jcl.recruit.searchresume.SearchResumeRecordDao;
import com.jcl.recruit.searchresume.model.SearchResumeRecord;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @ClassName SearchResumeRecordLogic

 * @Author yyliu
 * @Date 2018/10/31 11:35
 * @Version 1.0
 **/
@Component
public class SearchResumeRecordLogic {

    @Autowired
    private SearchResumeRecordDao searchResumeRecordDao;

    public List<SearchResumeRecord> findList(String corpCode,
                                             Integer userId,
                                             Integer status) {
        return this.findList(corpCode, userId, status, null, null);
    }

    public List<SearchResumeRecord> findListByWechat(String corpCode,
                                                     Integer userId) {
        return this.findList(corpCode, userId, Constant.NUMBER_0, Constant.NUMBER_0, null);
    }

    public List<SearchResumeRecord> findList(String corpCode,
                                             Integer userId,
                                             Integer status,
                                             Integer wechatPush,
                                             Integer emailPush) {
        return searchResumeRecordDao.findList(corpCode, userId, status, wechatPush, emailPush);
    }

    public List<SearchResumeRecord> findListByCondition(String codeCode,
                                                        Integer userId,
                                                        String keyword,
                                                        String city,
                                                        String education,
                                                        Integer workYear,
                                                        Integer wechatPush,
                                                        Integer emailPush) {
        return searchResumeRecordDao.findListByCondition(codeCode, userId,
                keyword, city, education, workYear, wechatPush, emailPush);
    }

    public List<SearchResumeRecord> findListByKeyword(String corpCode, String keyword) {
        return searchResumeRecordDao.findListByKeyword(corpCode, keyword);
    }

    public SearchResumeRecord findOne(String corpCode, Integer id) {
        return searchResumeRecordDao.findOne(corpCode, id);
    }

    public int insert(SearchResumeRecord record) {
        return searchResumeRecordDao.insert(record);
    }

    public int update(SearchResumeRecord record) {
        return searchResumeRecordDao.update(record);
    }

    public int deleteById(String corpCode, Integer id) {
        return searchResumeRecordDao.deleteById(corpCode, id);
    }
}
